package com.ruoyi.testDeal.controller;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.service.IJkSbDjInfoService;
import com.ruoyi.testDeal.domain.equInfo.JkSbDjInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 金属非金属水泵电动机参数Controller
 *
 * @author ruoyi
 * @date 2024-04-09
 */
@RestController
@RequestMapping("/testDeal/jkSbDjInfo")
public class JkSbDjInfoController extends BaseController
{
    @Autowired
    private IJkSbDjInfoService jkSbDjInfoService;

    /**
     * 查询金属非金属水泵电动机参数列表
     */
    @GetMapping("/list")
    public TableDataInfo list(JkSbDjInfo jkSbDjInfo)
    {
        startPage();
        List<JkSbDjInfo> list = jkSbDjInfoService.selectJkSbDjInfoList(jkSbDjInfo);
        return getDataTable(list);
    }

    /**
     * 导出金属非金属水泵电动机参数列表
     */
    @Log(title = "金属非金属水泵电动机参数", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, JkSbDjInfo jkSbDjInfo)
    {
        List<JkSbDjInfo> list = jkSbDjInfoService.selectJkSbDjInfoList(jkSbDjInfo);
        ExcelUtil<JkSbDjInfo> util = new ExcelUtil<JkSbDjInfo>(JkSbDjInfo.class);
        util.exportExcel(response, list, "金属非金属水泵电动机参数数据");
    }

    /**
     * 获取金属非金属水泵电动机参数详细信息
     */
    @GetMapping(value = "/{sbDjid}")
    public AjaxResult getInfo(@PathVariable("sbDjid") Long sbDjid)
    {
        return success(jkSbDjInfoService.selectJkSbDjInfoBySbDjid(sbDjid));
    }

    /**
     * 新增金属非金属水泵电动机参数
     */
    @Log(title = "金属非金属水泵电动机参数", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody JkSbDjInfo jkSbDjInfo)
    {
        return toAjax(jkSbDjInfoService.insertJkSbDjInfo(jkSbDjInfo));
    }

    /**
     * 修改金属非金属水泵电动机参数
     */
    @Log(title = "金属非金属水泵电动机参数", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody JkSbDjInfo jkSbDjInfo)
    {
        return toAjax(jkSbDjInfoService.updateJkSbDjInfo(jkSbDjInfo));
    }

    /**
     * 删除金属非金属水泵电动机参数
     */
    @Log(title = "金属非金属水泵电动机参数", businessType = BusinessType.DELETE)
    @DeleteMapping("/{sbDjids}")
    public AjaxResult remove(@PathVariable Long[] sbDjids)
    {
        return toAjax(jkSbDjInfoService.deleteJkSbDjInfoBySbDjids(sbDjids));
    }
}
